package com.woniu.learnredis.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.ValueOperations;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;

/**
 * created by woniu201
 * created in 2018/7/7
 */
@RestController
public class MyController {

    @Autowired
    private ValueOperations<String, Object> valueOperations;

    @RequestMapping(value = "/test1", method = RequestMethod.GET)
    public String test1(HttpServletRequest request){
        String name = request.getParameter("name");
        String age = request.getParameter("age");
        System.out.println(name + age);
        valueOperations.set(name, age);
        return "succ";
    }
}
